<div id="Merging-two-revisions"></div>
<div class="header">
<p>
Next: [[cvs: Merging can add or remove files#Merging can add or remove files|Merging adds and removals]], Previous: [[cvs: Merging from a branch several times#Merging from a branch several times|Merging more than once]], Up: [[cvs: Branching and merging#Branching and merging|Branching and merging]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Merging-differences-between-any-two-revisions"></div>
=== Merging differences between any two revisions ===
<div id="index-Merging-two-revisions"></div>
<div id="index-Revisions_002c-merging-differences-between"></div>
<div id="index-Differences_002c-merging"></div>

With two &lsquo;<code>-j <var>revision</var></code>&rsquo; flags, the <code>update</code>
(and <code>checkout</code>) command can merge the differences
between any two revisions into your working file.

<div id="index-Undoing-a-change"></div>
<div id="index-Removing-a-change"></div>
<div class="example" style="margin-left: 3.2em">
 $ cvs update -j 1.5 -j 1.3 backend.c
</div>

will undo all changes made between revision
1.3 and 1.5.  Note the order of the revisions!

If you try to use this option when operating on
multiple files, remember that the numeric revisions will
probably be very different between the various files.
You almost always use symbolic
tags rather than revision numbers when operating on
multiple files.

<div id="index-Restoring-old-version-of-removed-file"></div>
<div id="index-Resurrecting-old-version-of-dead-file"></div>
Specifying two &lsquo;<code>-j</code>&rsquo; options can also undo file
removals or additions.  For example, suppose you have
a file
named &lsquo;<tt>file1</tt>&rsquo; which existed as revision 1.1, and
you then removed it (thus adding a dead revision 1.2).
Now suppose you want to add it again, with the same
contents it had previously.  Here is how to do it:

<div class="example" style="margin-left: 3.2em">
 $ cvs update -j 1.2 -j 1.1 file1
 U file1
 $ cvs commit -m test
 Checking in file1;
 /tmp/cvs-sanity/cvsroot/first-dir/file1,v  &lt;--  file1
 new revision: 1.3; previous revision: 1.2
 done
 $
</div>

This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
